<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="probiz" tagdir="/WEB-INF/tags/probiz"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<title><fmt:message key="systemMessage.system_title"/></title>
<style type="text/css">
	.message_bigFont{
		font-weight: bold;
	}
</style>
<fmt:message key="button.close" var="closeMessage"/>
<fmt:message key="systemMessage.system_title" var="systemMessageTitle"/>

<content tag="position">
	<fmt:message key="accountMenu.serviceCenter" /> &gt; <b><fmt:message key="systemMessage.system_title"/></b>
</content>

<div class="one_tab">
	<div class="tab_05">
	<ul class="content clearfix">
		<li class="curr">
			<span><fmt:message key="systemMessages.tab.all_list"/></span>
		</li>
		<li>
			<span><a href="${ctxPath}/customer/csSystemMessages.html"><fmt:message key="systemMessages.tab.never_read_list"/></a></span>
		</li>
	</ul>
	</div>
</div>


<div class="list_message">
<form id="feedback" method="post">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_message" id="systemMessageTbl">
      <tr>
				<th><fmt:message key="systemMessages.message_content"/></th>
				<th width="18%"><fmt:message key="systemMessages.message_date"/></th>
      			<th width="10%"><input type="checkbox" name=""  id="checkAllRead" />&nbsp;<a class="delete" id="readMessageDelete" href="##"><fmt:message key="status.deleted"/></a></th>
		</tr>
	  <c:forEach items="${systemMessagesList}" var="message" varStatus="i">
		<tr class="check_read_allChild ">
				<td>
					<a href="#" onclick="readMessage(${message.systemMessageId})">
					 <span id='message_content_${message.systemMessageId}' <c:if test="${message.status==1}">class="message_bigFont"</c:if>>${message.messageHtml}</span>
					 <span id='message_read_${message.systemMessageId}'><c:if test="${message.status==1}">[<fmt:message key="systemMessages.never_read"/>]</c:if></span>
				 </a>
				 
				 </td>
				<td><span class="gray"><fmt:formatDate value="${message.createTime}"
					pattern="yyyy-MM-dd HH:mm:ss" /></span></td>
				<td align="left"><input type="checkbox" name="readMessageId" value="${message.systemMessageId}"/>
					<a href="${ctxPath}/customer/csSystemMessages.html?type=A&doAction=delMessage&messageId=${message.systemMessageId}&PrmPageNo=${PrmPageNo }">
					 <fmt:message key="systemMessage.del_operation"/>
					 </a>
				</td>
		</tr>
	 </c:forEach>
	 <c:if test="${fn:length(systemMessagesList)==0}">
		<tr>
			<td colspan="3">
				<fmt:message key="tables.noItemsDisplay" />
			</td>
		</tr>
	  </c:if>
    </table>
    
    
    <div class="page_bottom clearfix">
		<%@ include file="../common/pagingOnly.jsp"%>
	</div>
</form>
</div>
<probiz:ui_dialog id="readSystemMessage"  width="400" height="250" title='${systemMessageTitle}' buttons="'${closeMessage}':fncloseMessage">
<span id="systemMessageId"></span>
</probiz:ui_dialog>
<script type="text/javascript" src="${ctxPath}/scripts/probiz/customer/systemMessage.js?rs=${appConfig.rs}"></script>

<script type="text/javascript">
	function readMessage(messageId){
		var paramData={messageId:messageId};
		$j.post(__ctxPath+"/customer/csSystemMessages.html?doAction=readMessage",paramData,delSystemMessageCallback,"json");
	}
	
	function delSystemMessageCallback(data){
		if(data.result==1){
			$j('#message_content_'+data.messageId).removeClass('message_bigFont');
			$j('#message_read_'+data.messageId).html('');
			$j('#systemMessageId').html(data.content);
			dlgreadSystemMessage_show();
			//$j('#count_system_message_List').html('('+data.count+')');
			if($j('#systemMessageTbl tr').length <= 1){
				$j('#systemMessageTbl').append('<tr><td><fmt:message key="tables.noItemsDisplay" /></td></tr>');
			}
		}
	}
	
	function fncloseMessage(){
		dlgreadSystemMessage_close();
	}
</script>
